/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/

// function importAll(r) {
//   const imagesPath = r.keys();
//   const map = {};
//   let im = `\n`;

//   imagesPath.forEach((path) => {
//     const name = path.split('./')[1].slice(0, -4);
//     map[name] = {
//       icon: path,
//       name,
//     };

//     im += `import ${name} from '${path}';\n`;
//   });

//   console.log('🚀 ~ file: index.ts ~ line 23 ~ importAll ~ im', im);
//   return map;
// }

// const imageMap = importAll(require.context('./', false, /\.(png|jpe?g|svg)$/));
// console.log('🚀 ~ file: index.js ~ line 36 ~ imageMap', imageMap);

export const iconMap = {
};

export const findIcons = (title = '') => {
  title = title.trim();
  let iconObj = iconMap.ic28_count;
  for (const iconKey in iconMap) {
    const icon = iconMap[iconKey];
    if (icon.alias?.includes(title)) {
      iconObj = icon;
      break;
    }
  }

  return iconObj;
};